import Taro, { useState, useEffect, setStorage } from "@tarojs/taro";
import { View, Text, Button } from "@tarojs/components";
import Counter from './components/count'



const Index = () => {
  useEffect(() => {
    console.log("componentDidMount 生命周期");
  }, []);
  useEffect(() => {
    // 当在 useEffect 的回调函数中返回一个函数时，这个函数会在组件卸载前被调用。我们可以在这里面清除定时器或事件监听器。
    return () => {
      console.log("will unmount");
    };
  }, []);
  return (
    <View>
      <Counter initialCount={10}   />
      <Button openType="getPhoneNumber" bindgetphonenumber={handlePhone}>
        获取手机号码
      </Button>
      <Button openType="openSetting">打开用户授权页</Button>
      <Button openType="share">转发</Button>
    </View>
  );

  function handlePhone(res) {
    console.log("res: ", res);
  }

};

Index.config = {
    enablePullDownRefresh:true
}

export default Index;
